package com.pur.zsms.pmsnmanage.role.dao;

import java.util.List;

import com.pur.zsms.common.dao.JpaTemplate;
import com.pur.zsms.common.exception.GenericException;
import com.pur.zsms.common.support.PageController;
import com.pur.zsms.common.support.PaginationSupport;
import com.pur.zsms.documentsmanage.po.DomPo;
import com.pur.zsms.pmsnmanage.menu.po.MenuPo;
import com.pur.zsms.pmsnmanage.role.po.RoleMenuPo;
import com.pur.zsms.pmsnmanage.role.po.RolePo;
import com.pur.zsms.pmsnmanage.role.vo.RoleVo;
import com.pur.zsms.pmsnmanage.user.po.UserPo;
import com.pur.zsms.pmsnmanage.user.po.UserRolePo;
import com.pur.zsms.pmsnmanage.user.vo.UserVo;

public interface IRoleDao {

	/**
	 * 查询出所有角色信息
	 * 
	 * @return
	 */
	public PaginationSupport listRole(PageController pageController, RoleVo roleVo) throws GenericException;

	/**
	 * 根据roleName查寻角色信息
	 * 
	 * @param roleName
	 * @return
	 */
	public List<RolePo> findByRoleName(String roleName) throws GenericException;

	public List<RolePo> getRolePoByRoleNameUserId(UserPo userPo, String roleName) throws GenericException;

	/**
	 * 新增角色信息
	 */
	public void addRole(RolePo c) throws GenericException;

	/**
	 * 新增角色赋予菜单权限
	 * 
	 * @author liyuxin
	 * @param roleVo
	 * @param menuIds
	 * @throws GenericException
	 */
	public void addRoleMenu(RoleVo roleVo, Long[] menuIds) throws GenericException;

	public void addRoleMenu(RoleVo roleVo) throws GenericException;

	/**
	 * 修改角色信息
	 */
	public void updateRole(RolePo c) throws GenericException;

	/**
	 * 删除角色信息
	 */
	public void deleteRole(Long roleId) throws GenericException;

	/**
	 * 根据角色ID查询出该角色所有角色信息
	 * 
	 * @param RoleId
	 *            用户ID
	 * @return 用户角色信息
	 */
	public List<UserRolePo> listUserRoleByRoleId(String roleId) throws GenericException;

	public List<RolePo> listAllRole() throws GenericException;

	public List<RolePo> listRoleByIdentity(String identity) throws GenericException;

	/**
	 * @author liyuxin
	 * @param roleId
	 * @return
	 * @throws GenericException
	 */
	public RolePo findRoleById(Long roleId) throws GenericException;

	public RolePo findRoleByCompanyIdForSupplier(int companyId) throws GenericException;

	public UserPo findUserById(String userId) throws GenericException;

	/**
	 * @author liyuxin
	 * @param roleId
	 * @return
	 * @throws GenericException
	 */
	public List<RoleMenuPo> findMenusByRole(Long roleId) throws GenericException;

	/**
	 * 获取角色菜单关系实体列表
	 * 
	 * @author liyuxin
	 * @param roleId
	 * @return
	 * @throws GenericException
	 */
	public List<RoleMenuPo> findRoleMenus(Long roleId) throws GenericException;

	/*
	 * public void updateRoleMenu(RoleVo roleVo,Long[] menuIds) throws
	 * GenericException;
	 */
	/**
	 * 删除角色菜单关系实体
	 * 
	 * @author liyuxin
	 * @param roleMenuPo
	 * @throws GenericException
	 */
	public void deleteRoleMenu(RoleMenuPo roleMenuPo) throws GenericException;

	/**
	 * 更新角色菜单关系实体
	 * 
	 * @author liyuxin
	 * @param roleMenuPo
	 * @throws GenericException
	 */
	public void updateRoleMenu(RoleVo roleVo) throws GenericException;

	/**
	 * 新增新角色菜单关系实体
	 * 
	 * @author liyuxin
	 * @param roleMenuPo
	 * @throws GenericException
	 */
	public void addRoleMenu(RoleMenuPo roleMenuPo) throws GenericException;

	/**
	 * 获取用户角色关系列表
	 * 
	 * @author liyuxin
	 * @param roleId
	 * @return
	 * @throws GenericException
	 */
	public List<UserRolePo> findUserRoles(Long roleId) throws GenericException;

	public List<MenuPo> getAllMenuPo(long id) throws GenericException;

	public List<MenuPo> getParentMenuById(String menuId) throws GenericException;

}
